package com.example.demo.controller;


import com.example.demo.utils.RsaUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.Base64;

@RestController
public class test {
    @RequestMapping("/hello")
    public String hello(){

//        String plainText = "Hello, World!";
//        KeyPair keyPair = RsaUtil.generateKeyPair();
//
//        PrivateKey aPrivate = keyPair.getPrivate();
//        PublicKey aPublic = keyPair.getPublic();
//        byte[] encryptedBytes = RsaUtil.encrypt(plainText, aPublic);
//        System.out.println(Base64.getEncoder().encodeToString(encryptedBytes));
//
//        byte[] decryptedBytes = RsaUtil.decrypt(encryptedBytes, aPrivate);
//        System.out.println(new String(decryptedBytes));

        return "ddd";
//        throw new BusinessException(BusinessExceptionCode.REDIS_WRITE_ERROR_CODE);
    }
}
